package org.etherframework.core.context
{
	public class Context
	{
		private var _data:*;

		public function get data():* { return _data; }
		
		public function Context(data:* = null)
		{
			_data = data;
		}
		
		public function copy():Context
		{
			var type:Class = this["constructor"];
			return new type(data);
		}
		
		public function merge(value:Context):void
		{
			if (value && equals(value))
			{
				_data = value.data;
			}
		}
		
		public function equals(value:Context):Boolean
		{
			return (value && value["constructor"] == this["constructor"]);
		}
		
		public function isType(type:Class):Boolean
		{
			return this["constructor"] == type;
		}
		
		public function toString():String
		{
			return "[Context data=" + _data + "]";
		}
	}
}